package qmsz.api.service.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import qmsz.api.dao.QMProvCityDistDAO;
import qmsz.api.domain.QMCity;
import qmsz.api.domain.QMDistrict;
import qmsz.api.domain.QMProvince;
import qmsz.api.service.QMProvCityDistService;

@Service
public class QMProvCityDistServiceImpl implements QMProvCityDistService {
	
	private static final Logger logger = Logger.getLogger(QMProvCityDistServiceImpl.class);

	@Autowired
	private QMProvCityDistDAO qmpcdDAO;
	
	@Override
	public List<QMProvince> listProvince() {
		List<QMProvince> value = null;
		try {
			value = qmpcdDAO.listProvince();
		} catch (Exception e) {
			logger.error("query error", e);
			value = null;
		}
		return value;
	}
	
	@Override
	public List<QMCity> listCityByProvID(Integer ProvinceID) {
		List<QMCity> value = null;
		try {
			value = qmpcdDAO.listCityByProvID(ProvinceID);
		} catch (Exception e) {
			logger.error("query error", e);
			value = null;
		}
		return value;
	}
	
	@Override
	public List<QMDistrict> listDistByCityID(Integer CityID) {
		List<QMDistrict> value = null;
		try {
			value = qmpcdDAO.listDistByCityID(CityID);
		} catch (Exception e) {
			logger.error("query error", e);
			value = null;
		}
		return value;
	}
}
